package com.leyou.advice;

import com.leyou.exception.LyException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author ：qcq
 * @date ：Created in 2020/12/3 20:55
 * @description：
 */
@ControllerAdvice
public class ControllerExceptionAdvice {
    @ExceptionHandler(LyException.class)
    public ResponseEntity<String> handleLyException(LyException e) {
        return ResponseEntity.status(e.getStatus()).body(e.getMessage());
    }
}
